<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.mfp.java.testYou.ui.mvc.UserPage" %>
<%@ page import="com.mfp.java.testYou.core.servlets.ManageUserServlet" %>
<%@ page import="com.mfp.java.testYou.core.AppContext" %>
<%@page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="../global/global.jsp" %>
<%UsersPage usersPage = new UsersPage(request, response);%>
<c:set var="usersPage" value="<%=usersPage%>"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
    <jsp:include page="../components/htmlHeader.jsp"></jsp:include>
    <title><testU:i18n>usersPage.title</testU:i18n></title>
    <script language="JavaScript" src="<%=cPath%>/testYou/resources/validations.js">
    </script>

</head>
<body class="bgColor textColor">
<jsp:include page="../components/header.jsp"/>
<c:set var="userPage" value="<%=new UserPage(request,response)%>"/>
<c:set var="currentUser" value="<%=AppContext.getUserSession(request).getUserName()%>"/>
<br><br>
<%if (usersPage.hasMessage()){%>
<center><testU:i18n>${usersPage.getMessage()}</testU:i18n></center>
<%} %>

<br>
<form action="<%=cPath%><%=response.encodeURL(ManageUserServlet.URL)%>" method="post" id="usersForm" name="usersForm">
    <input type="hidden" value="edit_delete_will_be_changed" name="<%=ManageUserServlet.OPERATION%>" id="hiddenField">
    <table class="centerTable30marg width40">
        <tr>
            <td rowspan="3" class="alignCenter">
                <tU:selectListComponent validate="true" editButtonId="editButton" formName="usersForm" deleteButtonId="deleteButton"/>
            </td>
            <td>
                <c:set var="ro" value="ro"/>
                <c:set var="langID" value="${empty userPage.user.lang ? ro  : userPage.user.lang}"/>
                <c:set value="<%=ManageUserServlet.OPERATION_EDIT%>" var="edit"/>
                <input class="width110" type="submit" value='<testU:i18n>usersPage.edit</testU:i18n>' id="editButton" disabled="disabled"
                       onclick="operEdit('${edit}', 'usersForm');"/>
            </td>
        </tr>
        <tr>
            <td>
                <c:set value="<%=ManageUserServlet.OPERATION_DELETE%>" var="delete"/>
                <input class="width110" type="submit" value="<testU:i18n>usersPage.delete</testU:i18n>" id="deleteButton" disabled="disabled"
                        onclick="operDeleteUser('${delete}', 'usersForm', '${currentUser}');"/>
            </td>
        </tr>

        <tr>
            <td>
                <c:set value="<%=ManageUserServlet.OPERATION_NEW%>" var="newOp"/>
                <input class="width110" type="submit" value='<testU:i18n>usersPage.new</testU:i18n>' id="addButton"
                        onclick="operAdd('${newOp}', 'usersForm');"/>
            </td>
        </tr>
    </table>
</form>
<%if (usersPage.hasError()){%>
<script type="text/javascript">
    alert('<testU:i18n>${usersPage.getError()}</testU:i18n>');
</script>
<%} %>
</body>

</html>